<template>
  <div class="p-2">
    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
      <div v-show="showSearch" class="mb-[10px]">
        <el-card shadow="hover">
          <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="145">
            <div :style="{ 'height': `${isexpand ? 'auto' : '100px'}`, 'overflow': 'hidden' }">
              <el-form-item label="案件号" prop="claimId">
                <el-input v-model="queryParams.claimId" placeholder="请输入案件号" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="拒赔原因" prop="refusalReason">
                <el-input v-model="queryParams.refusalReason" placeholder="请输入拒赔原因" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="审核意见备注" prop="auditRemark">
                <el-input v-model="queryParams.auditRemark" placeholder="请输入审核意见备注" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="用户反馈" prop="userFeedback">
                <el-input v-model="queryParams.userFeedback" placeholder="请输入用户反馈" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="修改后的理赔方式" prop="modifiedClaimMethod">
                <el-input v-model="queryParams.modifiedClaimMethod" placeholder="请输入修改后的理赔方式" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="修改后的赔付方式" prop="modifiedPaymentMethod">
                <el-input v-model="queryParams.modifiedPaymentMethod" placeholder="请输入修改后的赔付方式" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="审核费" prop="auditFee">
                <el-input v-model="queryParams.auditFee" placeholder="请输入审核费" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="修改后的索赔金额" prop="modifiedClaimedAmount">
                <el-input v-model="queryParams.modifiedClaimedAmount" placeholder="请输入修改后的索赔金额" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="新机价格" prop="newMachinePrice">
                <el-input v-model="queryParams.newMachinePrice" placeholder="请输入新机价格" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="用户支付金额" prop="userPaidAmount">
                <el-input v-model="queryParams.userPaidAmount" placeholder="请输入用户支付金额" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="物料费" prop="materialFee">
                <el-input v-model="queryParams.materialFee" placeholder="请输入物料费" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="检测费" prop="testFee">
                <el-input v-model="queryParams.testFee" placeholder="请输入检测费" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="维修费" prop="repairFee">
                <el-input v-model="queryParams.repairFee" placeholder="请输入维修费" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="快递费" prop="expressFee">
                <el-input v-model="queryParams.expressFee" placeholder="请输入快递费" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="上门费" prop="homeVisitFee">
                <el-input v-model="queryParams.homeVisitFee" placeholder="请输入上门费" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="里程费" prop="mileageFee">
                <el-input v-model="queryParams.mileageFee" placeholder="请输入里程费" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="拉修费" prop="towingFee">
                <el-input v-model="queryParams.towingFee" placeholder="请输入拉修费" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="其它费用" prop="otherFee">
                <el-input v-model="queryParams.otherFee" placeholder="请输入其它费用" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="残值回收金额" prop="residualRecoveryAmount">
                <el-input v-model="queryParams.residualRecoveryAmount" placeholder="请输入残值回收金额" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="模式" prop="mode">
                <el-input v-model="queryParams.mode" placeholder="请输入模式" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="评价时间" prop="evaluationTime">
                <el-input v-model="queryParams.evaluationTime" placeholder="请输入评价时间" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="是否默认好评" prop="isDefaultPraise">
                <el-input v-model="queryParams.isDefaultPraise" placeholder="请输入是否默认好评" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="数据更新时间" prop="dataUpdateTime">
                <el-input v-model="queryParams.dataUpdateTime" placeholder="请输入数据更新时间" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="履约单状态描述" prop="performanceOrderStatusDesc">
                <el-input v-model="queryParams.performanceOrderStatusDesc" placeholder="请输入履约单状态描述" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="逆向运单号" prop="reverseWaybillNo">
                <el-input v-model="queryParams.reverseWaybillNo" placeholder="请输入逆向运单号" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="判责时间" prop="liabilityDeterminationTime">
                <el-input v-model="queryParams.liabilityDeterminationTime" placeholder="请输入判责时间" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="报案判责结果" prop="reportLiabilityResult">
                <el-input v-model="queryParams.reportLiabilityResult" placeholder="请输入报案判责结果" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="最终判责结果" prop="finalLiabilityResult">
                <el-input v-model="queryParams.finalLiabilityResult" placeholder="请输入最终判责结果" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="物流判责结果" prop="logisticsLiabilityResult">
                <el-input v-model="queryParams.logisticsLiabilityResult" placeholder="请输入物流判责结果" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="保司判责驳回原因" prop="insuranceCompanyLiabilityRejectReason">
                <el-input
                  v-model="queryParams.insuranceCompanyLiabilityRejectReason"
                  placeholder="请输入保司判责驳回原因"
                  clearable
                  @keyup.enter="handleQuery"
                />
              </el-form-item>
              <el-form-item label="逆向保价险-保司编码" prop="reverseInsuranceCompanyCode">
                <el-input
                  v-model="queryParams.reverseInsuranceCompanyCode"
                  placeholder="请输入逆向保价险-保司编码"
                  clearable
                  @keyup.enter="handleQuery"
                />
              </el-form-item>
              <el-form-item label="逆向保价险-保司名称" prop="reverseInsuranceCompanyName">
                <el-input
                  v-model="queryParams.reverseInsuranceCompanyName"
                  placeholder="请输入逆向保价险-保司名称"
                  clearable
                  @keyup.enter="handleQuery"
                />
              </el-form-item>
              <el-form-item label="理赔款" prop="claimAmount">
                <el-input v-model="queryParams.claimAmount" placeholder="请输入理赔款" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="已追回赔款" prop="recoveredClaimAmount">
                <el-input v-model="queryParams.recoveredClaimAmount" placeholder="请输入已追回赔款" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="打款时间" prop="paymentTime">
                <el-input v-model="queryParams.paymentTime" placeholder="请输入打款时间" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="折中激励费" prop="compromiseIncentiveFee">
                <el-input v-model="queryParams.compromiseIncentiveFee" placeholder="请输入折中激励费" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="是否为配件/耗材" prop="isAccessory">
                <el-input v-model="queryParams.isAccessory" placeholder="请输入是否为配件/耗材" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="用户分层级别" prop="userStratificationLevel">
                <el-input v-model="queryParams.userStratificationLevel" placeholder="请输入用户分层级别" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="用户分层类型名称" prop="userStratificationName">
                <el-input v-model="queryParams.userStratificationName" placeholder="请输入用户分层类型名称" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="用户打标调用时间" prop="userTagCallTime">
                <el-input v-model="queryParams.userTagCallTime" placeholder="请输入用户打标调用时间" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="是否妥投/到账" prop="isDeliveredReceived">
                <el-input v-model="queryParams.isDeliveredReceived" placeholder="请输入是否妥投/到账" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="换新机款开票费率" prop="newMachineInvoiceRate">
                <el-input v-model="queryParams.newMachineInvoiceRate" placeholder="请输入换新机款开票费率" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="换新机款是否开票" prop="isNewMachineInvoiced">
                <el-input v-model="queryParams.isNewMachineInvoiced" placeholder="请输入换新机款是否开票" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="是否售后新融合" prop="isAfterSalesNewIntegration">
                <el-input v-model="queryParams.isAfterSalesNewIntegration" placeholder="请输入是否售后新融合" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="责任编码" prop="liabilityCode">
                <el-input v-model="queryParams.liabilityCode" placeholder="请输入责任编码" clearable @keyup.enter="handleQuery" />
              </el-form-item>
              <el-form-item label="责任名称" prop="liabilityName">
                <el-input v-model="queryParams.liabilityName" placeholder="请输入责任名称" clearable @keyup.enter="handleQuery" />
              </el-form-item>
            </div>
            <div style="float: right">
              <el-form-item>
                <el-button type="success" icon="ArrowDown" @click="expandQuery">{{ isexpand ? '收起' : '展开' }}</el-button>
                <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
                <el-button icon="Refresh" @click="resetQuery">重置</el-button>
              </el-form-item>
            </div>
          </el-form>
        </el-card>
      </div>
    </transition>

    <el-card shadow="never">
      <template #header>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:attach:add']">新增</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:attach:edit']"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:attach:remove']"
              >删除</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-col :span="1.5">
              <el-upload
                v-model:file-list="fileList"
                class="upload-demo"
                action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
                multiple
                :on-preview="handlePreview"
                :on-remove="handleRemove"
                :before-remove="beforeRemove"
                :limit="1"
                :on-exceed="handleExceed"
              >
                <el-button type="warning" plain icon="Upload" v-hasPermi="['system:main:add']">导入</el-button>
                <!-- <template #tip>
                <div class="el-upload__tip">jpg/png files with a size less than 500KB.</div>
              </template> -->
              </el-upload>
            </el-col>
          </el-col>
          <el-col :span="1.5">
            <el-button type="info" plain icon="Download" @click="handleExport" v-hasPermi="['system:attach:export']">导出</el-button>
          </el-col>
          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
      </template>

      <el-table v-loading="loading" border :data="attachList" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="自增主键" align="center" prop="id" v-if="true" />
        <el-table-column label="案件号" align="center" prop="claimId" />
        <el-table-column label="拒赔原因" align="center" prop="refusalReason" />
        <el-table-column label="审核意见备注" align="center" prop="auditRemark" />
        <el-table-column label="用户反馈" align="center" prop="userFeedback" />
        <el-table-column label="修改后的理赔方式" align="center" prop="modifiedClaimMethod" />
        <el-table-column label="修改后的赔付方式" align="center" prop="modifiedPaymentMethod" />
        <el-table-column label="审核费" align="center" prop="auditFee" />
        <el-table-column label="修改后的索赔金额" align="center" prop="modifiedClaimedAmount" />
        <el-table-column label="新机价格" align="center" prop="newMachinePrice" />
        <el-table-column label="用户支付金额" align="center" prop="userPaidAmount" />
        <el-table-column label="物料费" align="center" prop="materialFee" />
        <el-table-column label="检测费" align="center" prop="testFee" />
        <el-table-column label="维修费" align="center" prop="repairFee" />
        <el-table-column label="快递费" align="center" prop="expressFee" />
        <el-table-column label="上门费" align="center" prop="homeVisitFee" />
        <el-table-column label="里程费" align="center" prop="mileageFee" />
        <el-table-column label="拉修费" align="center" prop="towingFee" />
        <el-table-column label="其它费用" align="center" prop="otherFee" />
        <el-table-column label="残值回收金额" align="center" prop="residualRecoveryAmount" />
        <el-table-column label="模式" align="center" prop="mode" />
        <el-table-column label="评价时间" align="center" prop="evaluationTime" />
        <el-table-column label="是否默认好评" align="center" prop="isDefaultPraise" />
        <el-table-column label="数据更新时间" align="center" prop="dataUpdateTime" />
        <el-table-column label="履约单状态描述" align="center" prop="performanceOrderStatusDesc" />
        <el-table-column label="逆向运单号" align="center" prop="reverseWaybillNo" />
        <el-table-column label="判责时间" align="center" prop="liabilityDeterminationTime" />
        <el-table-column label="报案判责结果" align="center" prop="reportLiabilityResult" />
        <el-table-column label="最终判责结果" align="center" prop="finalLiabilityResult" />
        <el-table-column label="物流判责结果" align="center" prop="logisticsLiabilityResult" />
        <el-table-column label="保司判责驳回原因" align="center" prop="insuranceCompanyLiabilityRejectReason" />
        <el-table-column label="逆向保价险-保司编码" align="center" prop="reverseInsuranceCompanyCode" />
        <el-table-column label="逆向保价险-保司名称" align="center" prop="reverseInsuranceCompanyName" />
        <el-table-column label="理赔款" align="center" prop="claimAmount" />
        <el-table-column label="已追回赔款" align="center" prop="recoveredClaimAmount" />
        <el-table-column label="被追偿人/机构类型" align="center" prop="recoveredPartyType" />
        <el-table-column label="打款时间" align="center" prop="paymentTime" />
        <el-table-column label="支付状态" align="center" prop="paymentStatus" />
        <el-table-column label="折中激励费" align="center" prop="compromiseIncentiveFee" />
        <el-table-column label="是否为配件/耗材" align="center" prop="isAccessory" />
        <el-table-column label="用户分层级别" align="center" prop="userStratificationLevel" />
        <el-table-column label="用户分层类型名称" align="center" prop="userStratificationName" />
        <el-table-column label="用户分层类型" align="center" prop="userStratificationType" />
        <el-table-column label="用户打标调用时间" align="center" prop="userTagCallTime" />
        <el-table-column label="是否妥投/到账" align="center" prop="isDeliveredReceived" />
        <el-table-column label="换新机款开票费率" align="center" prop="newMachineInvoiceRate" />
        <el-table-column label="换新机款是否开票" align="center" prop="isNewMachineInvoiced" />
        <el-table-column label="是否售后新融合" align="center" prop="isAfterSalesNewIntegration" />
        <el-table-column label="责任编码" align="center" prop="liabilityCode" />
        <el-table-column label="责任名称" align="center" prop="liabilityName" />
        <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
          <template #default="scope">
            <el-tooltip content="修改" placement="top">
              <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:attach:edit']"></el-button>
            </el-tooltip>
            <el-tooltip content="删除" placement="top">
              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:attach:remove']"></el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>

      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
    </el-card>
    <!-- 添加或修改理赔附属对话框 -->
    <el-dialog :title="dialog.title" v-model="dialog.visible" width="90%" append-to-body>
      <el-form ref="attachFormRef" :model="form" :rules="rules" label-width="145" :inline="true" class="demo-form-inline">
        <el-form-item label="案件号" prop="claimId">
          <el-input v-model="form.claimId" placeholder="请输入案件号" />
        </el-form-item>
        <el-form-item label="拒赔原因" prop="refusalReason">
          <el-input v-model="form.refusalReason" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="审核意见备注" prop="auditRemark">
          <el-input v-model="form.auditRemark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="用户反馈" prop="userFeedback">
          <el-input v-model="form.userFeedback" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="修改后的理赔方式" prop="modifiedClaimMethod">
          <el-input v-model="form.modifiedClaimMethod" placeholder="请输入修改后的理赔方式" />
        </el-form-item>
        <el-form-item label="修改后的赔付方式" prop="modifiedPaymentMethod">
          <el-input v-model="form.modifiedPaymentMethod" placeholder="请输入修改后的赔付方式" />
        </el-form-item>
        <el-form-item label="审核费" prop="auditFee">
          <el-input v-model="form.auditFee" placeholder="请输入审核费" />
        </el-form-item>
        <el-form-item label="修改后的索赔金额" prop="modifiedClaimedAmount">
          <el-input v-model="form.modifiedClaimedAmount" placeholder="请输入修改后的索赔金额" />
        </el-form-item>
        <el-form-item label="新机价格" prop="newMachinePrice">
          <el-input v-model="form.newMachinePrice" placeholder="请输入新机价格" />
        </el-form-item>
        <el-form-item label="用户支付金额" prop="userPaidAmount">
          <el-input v-model="form.userPaidAmount" placeholder="请输入用户支付金额" />
        </el-form-item>
        <el-form-item label="物料费" prop="materialFee">
          <el-input v-model="form.materialFee" placeholder="请输入物料费" />
        </el-form-item>
        <el-form-item label="检测费" prop="testFee">
          <el-input v-model="form.testFee" placeholder="请输入检测费" />
        </el-form-item>
        <el-form-item label="维修费" prop="repairFee">
          <el-input v-model="form.repairFee" placeholder="请输入维修费" />
        </el-form-item>
        <el-form-item label="快递费" prop="expressFee">
          <el-input v-model="form.expressFee" placeholder="请输入快递费" />
        </el-form-item>
        <el-form-item label="上门费" prop="homeVisitFee">
          <el-input v-model="form.homeVisitFee" placeholder="请输入上门费" />
        </el-form-item>
        <el-form-item label="里程费" prop="mileageFee">
          <el-input v-model="form.mileageFee" placeholder="请输入里程费" />
        </el-form-item>
        <el-form-item label="拉修费" prop="towingFee">
          <el-input v-model="form.towingFee" placeholder="请输入拉修费" />
        </el-form-item>
        <el-form-item label="其它费用" prop="otherFee">
          <el-input v-model="form.otherFee" placeholder="请输入其它费用" />
        </el-form-item>
        <el-form-item label="残值回收金额" prop="residualRecoveryAmount">
          <el-input v-model="form.residualRecoveryAmount" placeholder="请输入残值回收金额" />
        </el-form-item>
        <el-form-item label="模式" prop="mode">
          <el-input v-model="form.mode" placeholder="请输入模式" />
        </el-form-item>
        <el-form-item label="评价时间" prop="evaluationTime">
          <el-input v-model="form.evaluationTime" placeholder="请输入评价时间" />
        </el-form-item>
        <el-form-item label="是否默认好评" prop="isDefaultPraise">
          <el-input v-model="form.isDefaultPraise" placeholder="请输入是否默认好评" />
        </el-form-item>
        <el-form-item label="数据更新时间" prop="dataUpdateTime">
          <el-input v-model="form.dataUpdateTime" placeholder="请输入数据更新时间" />
        </el-form-item>
        <el-form-item label="履约单状态描述" prop="performanceOrderStatusDesc">
          <el-input v-model="form.performanceOrderStatusDesc" placeholder="请输入履约单状态描述" />
        </el-form-item>
        <el-form-item label="逆向运单号" prop="reverseWaybillNo">
          <el-input v-model="form.reverseWaybillNo" placeholder="请输入逆向运单号" />
        </el-form-item>
        <el-form-item label="判责时间" prop="liabilityDeterminationTime">
          <el-input v-model="form.liabilityDeterminationTime" placeholder="请输入判责时间" />
        </el-form-item>
        <el-form-item label="报案判责结果" prop="reportLiabilityResult">
          <el-input v-model="form.reportLiabilityResult" placeholder="请输入报案判责结果" />
        </el-form-item>
        <el-form-item label="最终判责结果" prop="finalLiabilityResult">
          <el-input v-model="form.finalLiabilityResult" placeholder="请输入最终判责结果" />
        </el-form-item>
        <el-form-item label="物流判责结果" prop="logisticsLiabilityResult">
          <el-input v-model="form.logisticsLiabilityResult" placeholder="请输入物流判责结果" />
        </el-form-item>
        <el-form-item label="保司判责驳回原因" prop="insuranceCompanyLiabilityRejectReason">
          <el-input v-model="form.insuranceCompanyLiabilityRejectReason" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="逆向保价险-保司编码" prop="reverseInsuranceCompanyCode">
          <el-input v-model="form.reverseInsuranceCompanyCode" placeholder="请输入逆向保价险-保司编码" />
        </el-form-item>
        <el-form-item label="逆向保价险-保司名称" prop="reverseInsuranceCompanyName">
          <el-input v-model="form.reverseInsuranceCompanyName" placeholder="请输入逆向保价险-保司名称" />
        </el-form-item>
        <el-form-item label="理赔款" prop="claimAmount">
          <el-input v-model="form.claimAmount" placeholder="请输入理赔款" />
        </el-form-item>
        <el-form-item label="已追回赔款" prop="recoveredClaimAmount">
          <el-input v-model="form.recoveredClaimAmount" placeholder="请输入已追回赔款" />
        </el-form-item>
        <el-form-item label="打款时间" prop="paymentTime">
          <el-input v-model="form.paymentTime" placeholder="请输入打款时间" />
        </el-form-item>
        <el-form-item label="折中激励费" prop="compromiseIncentiveFee">
          <el-input v-model="form.compromiseIncentiveFee" placeholder="请输入折中激励费" />
        </el-form-item>
        <el-form-item label="是否为配件/耗材" prop="isAccessory">
          <el-input v-model="form.isAccessory" placeholder="请输入是否为配件/耗材" />
        </el-form-item>
        <el-form-item label="用户分层级别" prop="userStratificationLevel">
          <el-input v-model="form.userStratificationLevel" placeholder="请输入用户分层级别" />
        </el-form-item>
        <el-form-item label="用户分层类型名称" prop="userStratificationName">
          <el-input v-model="form.userStratificationName" placeholder="请输入用户分层类型名称" />
        </el-form-item>
        <el-form-item label="用户打标调用时间" prop="userTagCallTime">
          <el-input v-model="form.userTagCallTime" placeholder="请输入用户打标调用时间" />
        </el-form-item>
        <el-form-item label="是否妥投/到账" prop="isDeliveredReceived">
          <el-input v-model="form.isDeliveredReceived" placeholder="请输入是否妥投/到账" />
        </el-form-item>
        <el-form-item label="换新机款开票费率" prop="newMachineInvoiceRate">
          <el-input v-model="form.newMachineInvoiceRate" placeholder="请输入换新机款开票费率" />
        </el-form-item>
        <el-form-item label="换新机款是否开票" prop="isNewMachineInvoiced">
          <el-input v-model="form.isNewMachineInvoiced" placeholder="请输入换新机款是否开票" />
        </el-form-item>
        <el-form-item label="是否售后新融合" prop="isAfterSalesNewIntegration">
          <el-input v-model="form.isAfterSalesNewIntegration" placeholder="请输入是否售后新融合" />
        </el-form-item>
        <el-form-item label="责任编码" prop="liabilityCode">
          <el-input v-model="form.liabilityCode" placeholder="请输入责任编码" />
        </el-form-item>
        <el-form-item label="责任名称" prop="liabilityName">
          <el-input v-model="form.liabilityName" placeholder="请输入责任名称" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="Attach" lang="ts">
import { listAttach, getAttach, delAttach, addAttach, updateAttach } from '@/api/system/attach';
import { AttachVO, AttachQuery, AttachForm } from '@/api/system/attach/types';

const { proxy } = getCurrentInstance() as ComponentInternalInstance;

const attachList = ref<AttachVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);

const queryFormRef = ref<ElFormInstance>();
const attachFormRef = ref<ElFormInstance>();

const dialog = reactive<DialogOption>({
  visible: false,
  title: ''
});

const isexpand = ref(false);

const initFormData: AttachForm = {
  id: undefined,
  claimId: undefined,
  refusalReason: undefined,
  auditRemark: undefined,
  userFeedback: undefined,
  modifiedClaimMethod: undefined,
  modifiedPaymentMethod: undefined,
  auditFee: undefined,
  modifiedClaimedAmount: undefined,
  newMachinePrice: undefined,
  userPaidAmount: undefined,
  materialFee: undefined,
  testFee: undefined,
  repairFee: undefined,
  expressFee: undefined,
  homeVisitFee: undefined,
  mileageFee: undefined,
  towingFee: undefined,
  otherFee: undefined,
  residualRecoveryAmount: undefined,
  mode: undefined,
  evaluationTime: undefined,
  isDefaultPraise: undefined,
  dataUpdateTime: undefined,
  performanceOrderStatusDesc: undefined,
  reverseWaybillNo: undefined,
  liabilityDeterminationTime: undefined,
  reportLiabilityResult: undefined,
  finalLiabilityResult: undefined,
  logisticsLiabilityResult: undefined,
  insuranceCompanyLiabilityRejectReason: undefined,
  reverseInsuranceCompanyCode: undefined,
  reverseInsuranceCompanyName: undefined,
  claimAmount: undefined,
  recoveredClaimAmount: undefined,
  recoveredPartyType: undefined,
  paymentTime: undefined,
  paymentStatus: undefined,
  compromiseIncentiveFee: undefined,
  isAccessory: undefined,
  userStratificationLevel: undefined,
  userStratificationName: undefined,
  userStratificationType: undefined,
  userTagCallTime: undefined,
  isDeliveredReceived: undefined,
  newMachineInvoiceRate: undefined,
  isNewMachineInvoiced: undefined,
  isAfterSalesNewIntegration: undefined,
  liabilityCode: undefined,
  liabilityName: undefined
};
const data = reactive<PageData<AttachForm, AttachQuery>>({
  form: { ...initFormData },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    claimId: undefined,
    refusalReason: undefined,
    auditRemark: undefined,
    userFeedback: undefined,
    modifiedClaimMethod: undefined,
    modifiedPaymentMethod: undefined,
    auditFee: undefined,
    modifiedClaimedAmount: undefined,
    newMachinePrice: undefined,
    userPaidAmount: undefined,
    materialFee: undefined,
    testFee: undefined,
    repairFee: undefined,
    expressFee: undefined,
    homeVisitFee: undefined,
    mileageFee: undefined,
    towingFee: undefined,
    otherFee: undefined,
    residualRecoveryAmount: undefined,
    mode: undefined,
    evaluationTime: undefined,
    isDefaultPraise: undefined,
    dataUpdateTime: undefined,
    performanceOrderStatusDesc: undefined,
    reverseWaybillNo: undefined,
    liabilityDeterminationTime: undefined,
    reportLiabilityResult: undefined,
    finalLiabilityResult: undefined,
    logisticsLiabilityResult: undefined,
    insuranceCompanyLiabilityRejectReason: undefined,
    reverseInsuranceCompanyCode: undefined,
    reverseInsuranceCompanyName: undefined,
    claimAmount: undefined,
    recoveredClaimAmount: undefined,
    recoveredPartyType: undefined,
    paymentTime: undefined,
    paymentStatus: undefined,
    compromiseIncentiveFee: undefined,
    isAccessory: undefined,
    userStratificationLevel: undefined,
    userStratificationName: undefined,
    userStratificationType: undefined,
    userTagCallTime: undefined,
    isDeliveredReceived: undefined,
    newMachineInvoiceRate: undefined,
    isNewMachineInvoiced: undefined,
    isAfterSalesNewIntegration: undefined,
    liabilityCode: undefined,
    liabilityName: undefined,
    params: {}
  },
  rules: {
    id: [{ required: true, message: '自增主键不能为空', trigger: 'blur' }],
    claimId: [{ required: true, message: '案件号不能为空', trigger: 'blur' }]
  }
});

const { queryParams, form, rules } = toRefs(data);

/** 查询理赔附属列表 */
const getList = async () => {
  loading.value = true;
  const res = await listAttach(queryParams.value);
  attachList.value = res.rows;
  total.value = res.total;
  loading.value = false;
};

/** 取消按钮 */
const cancel = () => {
  reset();
  dialog.visible = false;
};

/** 表单重置 */
const reset = () => {
  form.value = { ...initFormData };
  attachFormRef.value?.resetFields();
};

/** 展开更多按钮操作 */
const expandQuery = () => {
  isexpand.value = !isexpand.value;
};

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.value.pageNum = 1;
  getList();
};

/** 重置按钮操作 */
const resetQuery = () => {
  queryFormRef.value?.resetFields();
  handleQuery();
};

/** 多选框选中数据 */
const handleSelectionChange = (selection: AttachVO[]) => {
  ids.value = selection.map((item) => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
};

/** 新增按钮操作 */
const handleAdd = () => {
  reset();
  dialog.visible = true;
  dialog.title = '添加理赔附属';
};

/** 修改按钮操作 */
const handleUpdate = async (row?: AttachVO) => {
  reset();
  const _id = row?.id || ids.value[0];
  const res = await getAttach(_id);
  Object.assign(form.value, res.data);
  dialog.visible = true;
  dialog.title = '修改理赔附属';
};

/** 提交按钮 */
const submitForm = () => {
  attachFormRef.value?.validate(async (valid: boolean) => {
    if (valid) {
      buttonLoading.value = true;
      if (form.value.id) {
        await updateAttach(form.value).finally(() => (buttonLoading.value = false));
      } else {
        await addAttach(form.value).finally(() => (buttonLoading.value = false));
      }
      proxy?.$modal.msgSuccess('操作成功');
      dialog.visible = false;
      await getList();
    }
  });
};

/** 删除按钮操作 */
const handleDelete = async (row?: AttachVO) => {
  const _ids = row?.id || ids.value;
  await proxy?.$modal.confirm('是否确认删除理赔附属编号为"' + _ids + '"的数据项？').finally(() => (loading.value = false));
  await delAttach(_ids);
  proxy?.$modal.msgSuccess('删除成功');
  await getList();
};

/** 导出按钮操作 */
const handleExport = () => {
  proxy?.download(
    'system/attach/export',
    {
      ...queryParams.value
    },
    `attach_${new Date().getTime()}.xlsx`
  );
};
/** 导入按钮操作 */
const handleUpload = () => {};
onMounted(() => {
  getList();
});
</script>
<style scoped lang="scss">
:deep(.el-form--inline .el-form-item) {
  margin-right: 25px !important;
}
.demo-form-inline {
  :deep(.el-form-item) {
    vertical-align: baseline !important;
  }
  :deep(.el-input) {
    width: 370px !important;
  }
  :deep(.el-textarea) {
    width: 370px !important;
  }
  :deep(.el-textarea__inner) {
    min-height: 100px !important;
  }
}
</style>
